<?php
/**
 * Created by PhpStorm.
 * User: Hoodps
 * Email: 791859814@qq.com
 * Date: 2022-04-10
 * Time: 16:06
 */

namespace app\cms\controller;


use think\admin\Controller;
use think\admin\helper\QueryHelper;
use app\cms\model\cmsWareInboundFinance;

/**
 * 财务管理
 * @package app\cms\controller
 */
class Finance extends Controller
{
    /**
     * 财务管理
     * @auth true
     * @menu true
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        cmsWareInboundFinance::mQuery()->layTable(function () {
            $this->title = '财务管理';
        }, function (QueryHelper $query) {
            $query->like('address_name,name')->dateBetween('create_time');
        });
    }

    /**
     * 添加仓库
     * @auth true
     */
    public function add()
    {
        cmsWareInboundFinance::mForm('form');
    }


    /**
     * 编辑仓库
     * @auth true
     */
    public function edit()
    {
        cmsWareInboundFinance::mForm('form');
    }

    /**
     * 修改仓库状态
     * @auth true
     */
    public function state()
    {
        cmsWareInboundFinance::mSave($this->_vali([
            'status.in:0,1'  => '状态值范围异常！',
            'status.require' => '状态值不能为空！',
        ]));
    }

    /**
     * 删除仓库
     * @auth true
     */
    public function remove()
    {
        cmsWareInboundFinance::mDelete();
    }
}